// 为count组件生产action对象

import { INCREMENT, DECREMENT } from "../constant"

export const  createIncrementAction = (data) => {
  return {
    type: INCREMENT,
    data
  }
}

export const  createDecrementAction = (data) => {
  return {
    type: DECREMENT,
    data
  }
}

// 异步action  返回的值是函数。  返回是对象（同步函数）
export const createIncrementAsyncAction = (data, time) => {
  return (dispatch) => {
    setTimeout (() => {
      dispatch (createIncrementAction (data))
    }, time)
  }
}